/*
* @Author: dyiwen
* @Date:   2020-09-21 18:25:47
* @Last Modified by:   dyiwen
* @Last Modified time: 2020-09-22 16:27:09
 */
package main

var (
	main_url      string
	apiprefix     string = "/api/v2.0/"
	loginprefix   string = "/audit-logs"
	project       string
	tags          string
	repo          string
	page          int64
	page_size     int64
	user          string
	password      string
	homedir       string = "/.harborctl/"
	path          string = ".harborctl.json"
	getprojectbox []ProjectResp
	getrepobox    []RepoResp
	getimagebox   []ImageResp
	conf          Config
)

type Config struct {
	Url      string
	User     string
	Password string
}

type ProjectResp struct {
	Project_id            int
	Owner_id              int
	Name                  string
	Creation_time         string
	Update_time           string
	Deleted               bool
	Owner_name            string
	Current_user_role_id  int
	Current_user_role_ids []int
	Repo_count            int
	Chart_count           int
	Metadata              struct {
		Public string
	}
	Cve_whitelist struct {
		Id            int
		Project_id    int
		Itmes         []string
		Creation_time string
		Update_time   string
	}
}

type RepoResp struct {
	Artifact_count int    `json:artifact_count`
	Creation_time  string `json:creation_time`
	Id             int    `json:id`
	Name           string `json:name`
	Project_id     int    `json:project_id`
	Update_time    string `json:update_time`
}

type ImageResp struct {
	Addition_links struct {
		Build_history struct {
			Absolute bool
			Href     string
		}
		Vulnerabilities struct {
			Absoulte bool
			Href     string
		}
	}
	Digest      string
	Extra_attrs struct {
		Architecture string
		Author       string
		Created      string
		Os           string
	}
	Id                  int
	Labels              string
	Manifest_media_type string
	Media_type          string
	Project_id          int
	Pull_time           string
	Push_time           string
	References          string
	Repository_id       int
	Size                int64
	Type                string
	Tags                []struct {
		Artifact_id   int
		Id            int
		Immutable     bool
		Name          string
		Pull_time     string
		Push_time     string
		Repository_id int
		Signed        bool
	}
}

type ProjectTable struct {
	Id            int
	Name          string
	Access        string
	Deleted       bool
	Owner_name    string
	Repo_Count    int
	Chart_count   int
	Creation_time string
}

type RepoTable struct {
	Id            int
	Name          string
	Project       string
	Image_Count   int
	Creation_time string
}

type ImageTable struct {
	Id        int
	Name      string
	Tags      string
	Size      string
	ARCH      string
	Push_time string
}
